/* import  {useEffect, useState} from 'react'
function App(){
    const [count, setCount] = useState(0)
    const a = 1
    useEffect(() => {
        //console.log('组件渲染完成');
                //清理副作用
            console.log('组件即将销毁了');           

    }, [a])                 //只有当count的值变更了，才会执行，相当于为count添加了副作用函数
    return (
        <div classNmae='App'>
            <button onClick={()=>(setCount(count+1))}>{count}</button>
        </div>)
}
export default App;  */
import { useEffect, useState } from "react";
function App(){
    let[count,setCount] = useState(0)
    useEffect(()=>{
        console.log("组件更新完毕");
    },[count])
    return(
        <div onClick={()=>{setCount(count+1)}}>{count}</div>
    )
}

export default App;